<?php

namespace Plugins\Edge\Admin\Service;


use App\Admin\Service\AbstractAdminService;
use App\Admin\Service\Traits\DestroyServiceTrait;
use App\Admin\Service\Traits\StoreServiceTrait;
use App\Admin\Service\Traits\UpdateServiceTrait;
use App\Admin\Service\Traits\SwitchServiceTrait;
use Plugins\Edge\Common\Model\News;
use App\Common\Util\EasySearch;

/**
 * Class NewsService
 */
class NewsService extends AbstractAdminService
{
    use StoreServiceTrait, UpdateServiceTrait, DestroyServiceTrait, SwitchServiceTrait;

    public function __construct()
    {
        $this->model = new News();
    }

    /**
     * @return array
     */
    public function lists(): array
    {
        $query = $this->model->alias('news')->field(["news.id","news.title","news.intro","news.is_top","news.cover","news.view_number","news.author","news.status","news.create_time"]);

        return EasySearch::create($query)->getData();
    }
}
